#ifndef _FLUID_SPARSE_MATRIX_H
#define _FLUID_SPARSE_MATRIX_H

#include "tbb/concurrent_vector.h"
#include "FluidSparseVector.h"

class Index3;

class FLuidSparseMatrix
{
	friend class CSRMatrix;
	friend class SimpleStrokeOptimizer;
	friend class TwowayCoupler;
public:
	FLuidSparseMatrix();
	FLuidSparseMatrix(const FLuidSparseMatrix& rhs);
	FLuidSparseMatrix(int numX, int numY, int numZ, int dim);
	~FLuidSparseMatrix();
	const FLuidSparseMatrix& operator= (const FLuidSparseMatrix& rhs);
	void SetDimension(int numX, int numY, int numZ, int dim);
	int GetDim() const;
	double GetValue(int rowI, int rowJ, int rowK, int columnI, int columnJ, int columnK);
	void SetValue(int rowI, int rowJ, int rowK, int columnI, int columnJ, int columnK, double value);
	void SetZero();
	void SetRow(int rowI, int rowJ, int rowK, const FluidSparseVector& rowValues);
	FluidSparseVector& GetRow(int rowI, int rowJ, int rowK);
	bool CheckSymmetry();
	bool CheckMMatrix();
	void ConstructTestMatrix();
	const Index3& GetIndex3D(int i) const;
private:
	int mNumX;
	int mNumY;
	int mNumZ;
	int mDim;
	std::vector<Index3> mRows;
	std::vector<FluidSparseVector> mRowValues;
	int*** mIndex3Dto1DMap;

};
#endif